function Lazer()
{                    
    this.x = 0;
    this.y = 0;
    this.image = document.getElementById( 'lazer' ); 
    this.speed = -10;
    this.width = 5;
    this.height = 10;   
    this.hp = 25;
    this.life = 'false';
}

Lazer.prototype.draw = function( context )
{     
    context.save();
                                        
    context.translate( this.x, this.y );
    context.drawImage( this.image, 0, 0, this.width, this.height );
    context.restore();
};

function getLazerGun( numLazer, lazerGun )
{             
    for ( var i = 0; i < numLazer; i++ )
    {
        if ( lazerGun[i].life == 'true' )
        {   
            lazerGun[i].y += lazerGun[i].speed;                           
            if ( lazerGun[i].y <= 0 )
            {
                lazerGun[i].life = 'false';    
            }   
        }
    }
    return lazerGun;
}

function isFreeGun( ship )
{
    var numFreeGun = 0;
    for ( var i = 0; i < ship.numLazer; i++ )
    {
        if ( ship.lazerGun[i].life == 'false' )
        {
            numFreeGun++;
        }
    }
    if ( numFreeGun >= 2 )
    {
        return 'true';
    }
    else
    {
        return 'false';
    }
}